﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;

namespace SetCLib
{
    [XmlRootAttribute(ElementName = "TitleValueItem", IsNullable = false)]
    public class TitleValueXML : INotifyPropertyChanged
    {
        #region Constructors

        public TitleValueXML()
        {
        }

        public TitleValueXML(string title, string value)
        {
            Title = title;
            Value = value;
        }

        #endregion

        #region Properties

        private string _Title;
        [XmlElementAttribute("Title")]
        public string Title
        {
            get { return _Title; }
            set
            {
                _Title = value;
                OnPropertyChanged("Title");
            }
        }

        private string _Value;
        [XmlElementAttribute("Value")]
        public string Value
        {
            get { return _Value; }
            set
            {
                _Value = value;
                OnPropertyChanged("Value");
            }
        }

        #endregion

        #region NotifyChanges

        // Create the OnPropertyChanged method to raise the event
        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
